package team.hyznrj.studentsys.configuration;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import team.hyznrj.studentsys.interceptor.LoginInterceptor;

/**
 * @author ReMidDream
 * @date 2018-05-10 13:21
 **/
@Configuration
public class InterceptorConfiguration extends WebMvcConfigurerAdapter {
	@Autowired
	LoginInterceptor interceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration loginInterceptor = registry.addInterceptor(interceptor);
        loginInterceptor
                .excludePathPatterns("/account/login","/swagger-resources/**")
                .addPathPatterns("/**");
        super.addInterceptors(registry);
    }
}
